#include "Avatar.h"
#include "Entity.h"
#include "../SGD Wrappers/CSGD_TextureManager.h"
#include "../SGD Wrappers/CSGD_Direct3D.h"
#include "../SGD Wrappers/CSGD_DirectInput.h"
#include "Game.h"
#include "GameplayState.h"
#include "AnimationManager.h"
#include "Animation.h"

CAvatar::CAvatar(void)
{
	TypeofObj = Obj_Avatar;
	m_pAnimManager = CAnimationManager::GetInstance();
	//m_pCurrAnimInfo = new CAnimationInfo();
	m_pCurrAnimInfo.SetCurrentAnimation( "zombie" );
	//m_pCurrAnimInfo->AddRef();
	m_pDI = CSGD_DirectInput::GetInstance();
	
}


CAvatar::~CAvatar(void)
{
	//m_pCurrAnimInfo->Release();

}

void CAvatar::Update( float fElapsedTime )
{
	CEntity::Update(fElapsedTime);
	m_pAnimManager->Update( &m_pCurrAnimInfo, fElapsedTime );
}

void CAvatar::Render( void )
{
	CSGD_Direct3D::GetInstance()->GetSprite()->Flush();

	//Replace with the animation engine
	CSGD_TextureManager::GetInstance()->Draw(GetImageID(), (int)(GetPosX()), (int)(GetPosY()),
		2,2);

	//Replace with the animation engine
	m_pAnimManager->Render( &m_pCurrAnimInfo, this->GetPosX(), this->GetPosY(), false, D3DCOLOR_ARGB( 255, 255, 255, 255 ) );
}

bool CAvatar::CheckCollision( IEntity* pOther )
{
	if( CEntity::CheckCollision(pOther) != true )
	{
		return false;
	}
	return false;
}